$(document).ajaxSend(function(e, xhr, opt){
    var token = localStorage.getItem("user_token");
    xhr.setRequestHeader("user_token_header", token);
});

function getUserInfo(userUrl) {
    $.ajax({
        url: userUrl,
        type: "get",
        success: function(result) {
            if(result.code == 200 && result.data != null) {
                $(".left .card h3").text(result.data.userName);
                $(".left .card a").attr("href", result.data.githubUrl);
            }
        },error: function(error) {
            
        }
    });
}

function logout() {
    localStorage.removeItem("user_token");
    location.href = "blog_login.html";
}